<template>
  <div>
    <p>欢迎你：{{name}}小朋友</p>
    <p>你当前所在的班级为：{{cla.cla.name}}</p>
    <ul>
      <li v-for='i in cla.cla.courses'>{{i.name}}</li>
    </ul>
    <button v-if='cla.cla.type<3' @click='changeCla'>升级</button>
  </div>
</template>

<script>

export default {
  name: "Regs",
  data(){
    return{
      name:localStorage.getItem('name'),
      id:localStorage.getItem('id'),
      cla:{}
    }
  },
  methods: {
    getStuMes(){
      this.axios.get('users/reg/?id='+this.id).then(res=>{
        this.cla = res.data.cla
      })
    },
    changeCla(){
      this.axios.post('users/changeClass/',{'id':this.id}).then(res=>{
        this.getStuMes()
      })
    }
  },
  mounted() {
    this.getStuMes()
  }
}
</script>

<style scoped>

</style>
